how to sort even and odd elements from the given list of elements